Significantly reduced the number of calls to gdk_draw_point() (and thus to
authorFederico Mena Quintero <federico@nuclecu.unam.mx>
Tue, 9 Mar 1999 21:26:57 +0000 (21:26 +0000)
committerArturo Espinosa <unammx@src.gnome.org>
Tue, 9 Mar 1999 21:26:57 +0000 (21:26 +0000)
1999-03-09  Federico Mena Quintero  <federico@nuclecu.unam.mx>

* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
the number of calls to gdk_draw_point() (and thus to X) by
clipping the points by hand.

* gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
the clip parameter.
(gtk_handle_box_paint): Only paint the handle if the expose area
intersects it.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkhandlebox.c
gtk/gtkstyle.c

index 43b0e345d7ba06c37393b5160a24f0f920dae607..fd78beb12fedd25223194e9c00efbbdb1797ca1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+1999-03-09  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+       * gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+       the number of calls to gdk_draw_point() (and thus to X) by
+       clipping the points by hand.
+
+       * gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
+       the clip parameter.
+       (gtk_handle_box_paint): Only paint the handle if the expose area
+       intersects it.
+
 Sun Mar  7 18:46:37 1999  ape@lrdpf.spacetec.no  (Asbjorn Pettersen)
 
        * gtk/gtkmain.c (add_dll_suffix): Add this function (OS/2 ver.)
index 43b0e345d7ba06c37393b5160a24f0f920dae607..fd78beb12fedd25223194e9c00efbbdb1797ca1b 100644 (file)
@@ -1,3 +1,14 @@
+1999-03-09  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+       * gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+       the number of calls to gdk_draw_point() (and thus to X) by
+       clipping the points by hand.
+
+       * gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
+       the clip parameter.
+       (gtk_handle_box_paint): Only paint the handle if the expose area
+       intersects it.
+
 Sun Mar  7 18:46:37 1999  ape@lrdpf.spacetec.no  (Asbjorn Pettersen)
 
        * gtk/gtkmain.c (add_dll_suffix): Add this function (OS/2 ver.)
index 43b0e345d7ba06c37393b5160a24f0f920dae607..fd78beb12fedd25223194e9c00efbbdb1797ca1b 100644 (file)
@@ -1,3 +1,14 @@
+1999-03-09  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+       * gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+       the number of calls to gdk_draw_point() (and thus to X) by
+       clipping the points by hand.
+
+       * gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
+       the clip parameter.
+       (gtk_handle_box_paint): Only paint the handle if the expose area
+       intersects it.
+
 Sun Mar  7 18:46:37 1999  ape@lrdpf.spacetec.no  (Asbjorn Pettersen)
 
        * gtk/gtkmain.c (add_dll_suffix): Add this function (OS/2 ver.)
index 43b0e345d7ba06c37393b5160a24f0f920dae607..fd78beb12fedd25223194e9c00efbbdb1797ca1b 100644 (file)
@@ -1,3 +1,14 @@
+1999-03-09  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+       * gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+       the number of calls to gdk_draw_point() (and thus to X) by
+       clipping the points by hand.
+
+       * gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
+       the clip parameter.
+       (gtk_handle_box_paint): Only paint the handle if the expose area
+       intersects it.
+
 Sun Mar  7 18:46:37 1999  ape@lrdpf.spacetec.no  (Asbjorn Pettersen)
 
        * gtk/gtkmain.c (add_dll_suffix): Add this function (OS/2 ver.)
index 43b0e345d7ba06c37393b5160a24f0f920dae607..fd78beb12fedd25223194e9c00efbbdb1797ca1b 100644 (file)
@@ -1,3 +1,14 @@
+1999-03-09  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+       * gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+       the number of calls to gdk_draw_point() (and thus to X) by
+       clipping the points by hand.
+
+       * gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
+       the clip parameter.
+       (gtk_handle_box_paint): Only paint the handle if the expose area
+       intersects it.
+
 Sun Mar  7 18:46:37 1999  ape@lrdpf.spacetec.no  (Asbjorn Pettersen)
 
        * gtk/gtkmain.c (add_dll_suffix): Add this function (OS/2 ver.)
index 43b0e345d7ba06c37393b5160a24f0f920dae607..fd78beb12fedd25223194e9c00efbbdb1797ca1b 100644 (file)
@@ -1,3 +1,14 @@
+1999-03-09  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+       * gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+       the number of calls to gdk_draw_point() (and thus to X) by
+       clipping the points by hand.
+
+       * gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
+       the clip parameter.
+       (gtk_handle_box_paint): Only paint the handle if the expose area
+       intersects it.
+
 Sun Mar  7 18:46:37 1999  ape@lrdpf.spacetec.no  (Asbjorn Pettersen)
 
        * gtk/gtkmain.c (add_dll_suffix): Add this function (OS/2 ver.)
index 43b0e345d7ba06c37393b5160a24f0f920dae607..fd78beb12fedd25223194e9c00efbbdb1797ca1b 100644 (file)
@@ -1,3 +1,14 @@
+1999-03-09  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+       * gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+       the number of calls to gdk_draw_point() (and thus to X) by
+       clipping the points by hand.
+
+       * gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
+       the clip parameter.
+       (gtk_handle_box_paint): Only paint the handle if the expose area
+       intersects it.
+
 Sun Mar  7 18:46:37 1999  ape@lrdpf.spacetec.no  (Asbjorn Pettersen)
 
        * gtk/gtkmain.c (add_dll_suffix): Add this function (OS/2 ver.)
index c64a94f8a4ce4a163d397a110d5a5d2017c45e79..30783ad60193fea1e5cf4d94a3f828fac68096fa 100644 (file)
@@ -690,7 +690,7 @@ draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, G
                     GdkRectangle *clip)
 {
    gtk_paint_handle(widget->style, window, GTK_STATE_NORMAL, shadow,
-                   NULL, widget, "handlebox",
+                   clip, widget, "handlebox",
                    rect->x, rect->y, rect->width, rect->height, 
                    GTK_ORIENTATION_VERTICAL);
 }
@@ -740,6 +740,7 @@ gtk_handle_box_paint (GtkWidget      *widget,
   guint width;
   guint height;
   GdkRectangle rect;
+  GdkRectangle dest;
 
   bin = GTK_BIN (widget);
   hb = GTK_HANDLE_BOX (widget);
@@ -797,7 +798,10 @@ gtk_handle_box_paint (GtkWidget      *widget,
       break;
     }
 
-  draw_textured_frame (widget, hb->bin_window, &rect, GTK_SHADOW_OUT, event ? &event->area : area);
+  if (gdk_rectangle_intersect (event ? &event->area : area, &rect, &dest))
+    draw_textured_frame (widget, hb->bin_window, &rect,
+                        GTK_SHADOW_OUT,
+                        event ? &event->area : area);
 
   if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
     {
index 02766dd1d27510d5c50d62e349f87796639fd3f7..323118dd3b484ff42727c194df280f249c41ea1a 100644 (file)
@@ -3054,7 +3054,9 @@ gtk_default_draw_handle (GtkStyle      *style,
   gint xx, yy;
   gint xthick, ythick;
   GdkGC *light_gc, *dark_gc;
+  GdkRectangle rect;
   GdkRectangle dest;
+  gint intersect;
   
   g_return_if_fail (style != NULL);
   g_return_if_fail (window != NULL);
@@ -3075,26 +3077,40 @@ gtk_default_draw_handle (GtkStyle      *style,
   xthick = style->klass->xthickness;
   ythick = style->klass->ythickness;
   
-  dest.x = x + xthick;
-  dest.y = y + ythick;
-  dest.width = width - (xthick * 2);
-  dest.height = height - (ythick * 2);
-  
-  gdk_gc_set_clip_rectangle (light_gc, &dest);
-  gdk_gc_set_clip_rectangle (dark_gc, &dest);
-  
+  rect.x = x + xthick;
+  rect.y = y + ythick;
+  rect.width = width - (xthick * 2);
+  rect.height = height - (ythick * 2);
+
+  if (area)
+    intersect = gdk_rectangle_intersect (area, &rect, &dest);
+  else
+    {
+      intersect = TRUE;
+      dest = rect;
+    }
+
+  if (!intersect)
+    return;
+
+#define DRAW_POINT(w, gc, clip, xx, yy)                \
+  {                                            \
+    if ((xx) >= (clip).x                       \
+       && (yy) >= (clip).y                     \
+       && (xx) < (clip).x + (clip).width       \
+       && (yy) < (clip).y + (clip).height)     \
+      gdk_draw_point ((w), (gc), (xx), (yy));  \
+  }
+
   for (yy = y + ythick; yy < (y + height - ythick); yy += 3)
     for (xx = x + xthick; xx < (x + width - xthick); xx += 6)
       {
-        gdk_draw_point (window, light_gc, xx, yy);
-        gdk_draw_point (window, dark_gc, xx + 1, yy + 1);
-        
-        gdk_draw_point (window, light_gc, xx + 3, yy + 1);
-        gdk_draw_point (window, dark_gc, xx + 4, yy + 2);
+       DRAW_POINT (window, light_gc, dest, xx, yy);
+       DRAW_POINT (window, dark_gc, dest, xx + 1, yy + 1);
+
+       DRAW_POINT (window, light_gc, dest, xx + 3, yy + 1);
+       DRAW_POINT (window, dark_gc, dest, xx + 4, yy + 2);
       }
-  
-  gdk_gc_set_clip_rectangle (light_gc, NULL);
-  gdk_gc_set_clip_rectangle (dark_gc, NULL);
 }
 
 static void